package com.weirong.smartvault.backservice.entity_model;

import com.weirong.smartvault.backservice.user.IUser;
import com.weirong.smartvault.entity.InStorageLog;
import com.weirong.smartvault.backservice.util.common.DateUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 于2017/12/4由 KFEB4 创建 .
 */
public class InStorageLogModel implements ListModelInterface {
    private InStorageLog inStorageLog;

    private List<String> keys;
    private List<String> keyNames;
    public InStorageLogModel(InStorageLog inStorageLog) {
        this.inStorageLog = inStorageLog;
        keys = new ArrayList<>();
        keyNames = new ArrayList<>();
        keyNames.add("入库时间");
        keys.add("getStorageTime");
        keyNames.add("经办人");
        keys.add("getHandlerName");
    }

    public String getStorageTime() {
        return DateUtil.getNomalString(this.inStorageLog.getStorageTime());
    }

    public String getHandlerName() {
        Integer id = this.inStorageLog.getHandler();
        IUser user = IUser.findOne(id);
        return user.getUserName();
    }

    @Override
    public List<String> keys() {
        return keys;
    }

    @Override
    public List<String> keyNames() {
        return keyNames;
    }

    public Integer getId() {
        return inStorageLog.getId();
    }
}
